<div class="panel">
    <div class="panel_content">
        <h2><%= "“#{@obj_name}”" unless @obj_name.blank? %>团队收支表一览</h2>
		<% unless @obj_name.blank? %>
		<%= link_to image_tag('cancl_16.gif'), tour_groups_path, :title=>"取消过滤" %>
		<%= link_to "取消过滤", tour_groups_path %>
		<% end %>
        <%= link_to image_tag('add_page_16.gif'), new_tour_group_path, :title=>"建立一个新的团队收支表" %>
        <%= link_to "建立一个新的团队收支表", new_tour_group_path, :title=>"建立一个新的团队收支表" %>
		<% if flash[:notice] %>
        <div id="notice">
            <%= flash[:notice] %>
        </div><br/>
        <% end %>
        <table class="form">
            <tr>
                <th>
                    序号
                </th>
                <th>
                    团号
                </th>
                <th>
                    日期
                </th>
                <th>
                    客源
                </th>
                <th>
                    国籍
                </th>
                <th>
                    人数
                </th>
                <th>
                    导游
                </th>
                <th>
                    司机
                </th>
                <th>
                    收费
                </th>
                <th>
                    总利润
                </th>
                <th>
                    负责人
                </th>
            </tr>
            <% for tour_group in @tour_groups %>
            <tr class="<%= cycle('odd', 'even')%>">
                <td>
                    <%= link_to tour_group.sequence, tour_group, :title => "点击查看收支表" %>
                    <%= link_to (image_tag 'play_16.gif', :alt => "在新窗口中打开"), tour_group, :target => "_blank" %>
                </td>
                <td>
                    <%= link_to tour_group.number, tour_group, :title => "点击查看收支表" %>
                    <%= link_to (image_tag 'play_16.gif', :alt => "在新窗口中打开"), tour_group, :target => "_blank" %>
                </td>
                <td>
                	<%= duration(tour_group.during_start, tour_group.during_end)%>
                </td>
                <td>
                    <%= h tour_group.customer.name unless tour_group.customer.nil? %>
                </td>
                <td>
                    <%= h tour_group.nationality.name unless tour_group.nationality.nil? %>
                </td>
                <td style="text-align: right">
                    <%= h tour_group.people %><%= ".#{tour_group.children}" if tour_group.children > 0 %>
                </td>
                <td>
                    <%= h tour_group.guide_involved.guide.name unless tour_group.guide_involved.guide.nil? %>
                </td>
                <td>
                    <%= h tour_group.vehicle.driver.name unless tour_group.vehicle.driver.nil? %>
                </td>
                <td style="text-align: right">
                    <%= number_to_rmb tour_group.revenue %>
                </td>
                <td style="text-align: right">
                    <%= number_to_rmb tour_group.total_profit %>
                </td>
                <td>
                    <%= h tour_group.owner.name unless tour_group.owner.nil? %>
                </td>
            </tr>
            <% end %>
			<tr class="sum">
				<td>
                    汇总
                </td>
                <td>
                    
                </td>
                <td>
                    
                </td>
                <td>
                    
                </td>
                <td>
                    
                </td>
                <td style="text-align: right">
                    <%= @all_people_count %><%= ".#{@all_children_count}" if @all_children_count > 0 %>
                </td>
                <td>
                    
                </td>
                <td>
                    
                </td>
                <td style="text-align: right">
                    
                </td>
                <td style="text-align: right">
                    <%= number_to_rmb @all_total_profit %>
                </td>
                <td>
                    
                </td>
			</tr>
        </table>
        <br/>
        <br/>
        <h2>筛选</h2>
        <br/>
        <br/>
        <div class="filter_panel">
			<%= render :partial => "filter_group", :locals =>{:title => "国籍", :klass => Nationality} %>
			<%= render :partial => "filter_group", :locals =>{:title => "客源", :klass => Customer} %>
			<%= render :partial => "filter_group", :locals =>{:title => "司机", :klass => Driver} %>
			<%= render :partial => "filter_group", :locals =>{:title => "导游", :klass => Guide} %>
			<%= render :partial => "filter_group", :locals =>{:title => "负责人", :klass => Employee} %>
        </div>
        <div style="clear:both">
        </div>
		<%= image_tag pie_chart %>
    </div>
</div>
